/*
 *  Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */

/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */

namespace carbon {
namespace test {
namespace thrift2 {

template <class Writer>
void TestCompactRequest::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, key_ref());
  writer.writeField(2 /* field id */, testEnum_ref());
  writer.writeField(3 /* field id */, testBool_ref());
  writer.writeField(4 /* field id */, testChar_ref());
  writer.writeField(5 /* field id */, testInt8_ref());
  writer.writeField(6 /* field id */, testInt16_ref());
  writer.writeField(7 /* field id */, testInt32_ref());
  writer.writeField(8 /* field id */, testInt64_ref());
  writer.writeField(9 /* field id */, testUInt8_ref());
  writer.writeField(10 /* field id */, testUInt16_ref());
  writer.writeField(11 /* field id */, testUInt32_ref());
  writer.writeField(12 /* field id */, testUInt64_ref());
  writer.writeField(13 /* field id */, testShortString_ref());
  writer.writeField(14 /* field id */, testLongString_ref());
  writer.writeField(15 /* field id */, testIobuf_ref());
  writer.writeField(16 /* field id */, testList_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestCompactRequest::visitFields(V&& v) {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
  if (!v.visitField(2, "testEnum", *this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(3, "testBool", *this->testBool_ref())) {
    return;
  }
  if (!v.visitField(4, "testChar", *this->testChar_ref())) {
    return;
  }
  if (!v.visitField(5, "testInt8", *this->testInt8_ref())) {
    return;
  }
  if (!v.visitField(6, "testInt16", *this->testInt16_ref())) {
    return;
  }
  if (!v.visitField(7, "testInt32", *this->testInt32_ref())) {
    return;
  }
  if (!v.visitField(8, "testInt64", *this->testInt64_ref())) {
    return;
  }
  if (!v.visitField(9, "testUInt8", *this->testUInt8_ref())) {
    return;
  }
  if (!v.visitField(10, "testUInt16", *this->testUInt16_ref())) {
    return;
  }
  if (!v.visitField(11, "testUInt32", *this->testUInt32_ref())) {
    return;
  }
  if (!v.visitField(12, "testUInt64", *this->testUInt64_ref())) {
    return;
  }
  if (!v.visitField(13, "testShortString", *this->testShortString_ref())) {
    return;
  }
  if (!v.visitField(14, "testLongString", *this->testLongString_ref())) {
    return;
  }
  if (!v.visitField(15, "testIobuf", *this->testIobuf_ref())) {
    return;
  }
  if (!v.visitField(16, "testList", *this->testList_ref())) {
    return;
  }
}

template <class V>
void TestCompactRequest::visitFields(V&& v) const {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
  if (!v.visitField(2, "testEnum", *this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(3, "testBool", *this->testBool_ref())) {
    return;
  }
  if (!v.visitField(4, "testChar", *this->testChar_ref())) {
    return;
  }
  if (!v.visitField(5, "testInt8", *this->testInt8_ref())) {
    return;
  }
  if (!v.visitField(6, "testInt16", *this->testInt16_ref())) {
    return;
  }
  if (!v.visitField(7, "testInt32", *this->testInt32_ref())) {
    return;
  }
  if (!v.visitField(8, "testInt64", *this->testInt64_ref())) {
    return;
  }
  if (!v.visitField(9, "testUInt8", *this->testUInt8_ref())) {
    return;
  }
  if (!v.visitField(10, "testUInt16", *this->testUInt16_ref())) {
    return;
  }
  if (!v.visitField(11, "testUInt32", *this->testUInt32_ref())) {
    return;
  }
  if (!v.visitField(12, "testUInt64", *this->testUInt64_ref())) {
    return;
  }
  if (!v.visitField(13, "testShortString", *this->testShortString_ref())) {
    return;
  }
  if (!v.visitField(14, "testLongString", *this->testLongString_ref())) {
    return;
  }
  if (!v.visitField(15, "testIobuf", *this->testIobuf_ref())) {
    return;
  }
  if (!v.visitField(16, "testList", *this->testList_ref())) {
    return;
  }
}

template <class Writer>
void TestCompactReply::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, result_ref());
  writer.writeField(2 /* field id */, valInt32_ref());
  writer.writeField(3 /* field id */, valInt64_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestCompactReply::visitFields(V&& v) {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
  if (!v.visitField(2, "valInt32", *this->valInt32_ref())) {
    return;
  }
  if (!v.visitField(3, "valInt64", *this->valInt64_ref())) {
    return;
  }
}

template <class V>
void TestCompactReply::visitFields(V&& v) const {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
  if (!v.visitField(2, "valInt32", *this->valInt32_ref())) {
    return;
  }
  if (!v.visitField(3, "valInt64", *this->valInt64_ref())) {
    return;
  }
}
} // namespace thrift2
} // namespace test
} // namespace carbon

namespace apache {
namespace thrift {
template <>
class Cpp2Ops<carbon::test::TestCompactRequest> {
 public:
  typedef carbon::test::TestCompactRequest Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestCompactReply> {
 public:
  typedef carbon::test::TestCompactReply Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};
} // namespace thrift
} // namespace apache
